<?php
/*!
 * Theme Name:One Nav
 * Theme URI:https://www.iotheme.cn/
 * Author:iowen
 * Author URI:https://www.iowen.cn/
 */
if ( ! defined( 'ABSPATH' ) ) { exit; } 
// 搜索列表请到 inc\search-list.php 文件修改
include( get_theme_file_path('/inc/search-list.php') ); 
?> 
<div class="s-search">
<div id="search" class="s-search mx-auto">
    <?php if($bm_route = get_query_var('bookmark_id')){ 
        global $bookmark_id,$bookmark_user,$bookmark_set;
        $big_title = get_bookmark_seting('sites_title',$bookmark_set);
        if($big_title!='' && get_bookmark_seting('hide_title',$bookmark_set)){
    ?>
    <div class="big-title text-center mb-3 mb-md-5 mt-2">
        <p class="h1" style="letter-spacing: 6px;"><?php echo $big_title ?></p>
    </div>
    <?php }
    }elseif(io_get_option('search_skin')['big_title']){ 
    ?>
    <div class="big-title text-center mb-3 mb-md-5 mt-2">
        <p class="h1" style="letter-spacing: 6px;"><?php echo io_get_option('search_skin')['big_title'] ?></p>
    </div>
    <?php } ?>
    <div id="search-list-menu" class="hide-type-list">
        <div class="s-type text-center overflow-x-auto">
            <div class="s-type-list big">
                <div class="anchor" style="position: absolute; left: 50%; opacity: 0;"></div>
                <label for="type-azhannei" class="active" data-id="group-z"><span><?php _e('站内','i_theme') ?></span></label>
                <?php $index=0; foreach ($search_list as $value) {
                    echo '<label for="'.$value['default'].'" '.( $index==0?'class=""':'').' data-id="'.$value['id'].'"><span>'.$value['name'].'</span></label>';
                    $index++;
                } ?>
            </div>
        </div>
    </div>
    <form action="<?php echo home_url() ?>?s=" method="get" target="_blank" class="super-search-fm">
        <input type="text" id="search-text" class="form-control smart-tips search-key" zhannei="" placeholder="<?php _e( '输入关键字搜索', 'i_theme' ); ?>" style="outline:0" autocomplete="off">
        <script>function goto_search(){window.location.href='//my.8kmm.com?q='+$("#search-text").val();}</script>
        <button type="submit"><i class="iconfont icon-search search-btn"></i><i class="io io-yunsousuo" onclick="goto_search();return false;" title="8K云搜" style="margin-left:5px"></i></button>
    </form> 
    <div id="search-list" class="hide-type-list">
        <div class="search-group group-z s-current">
            <ul class="search-type">
                <li ><input checked="checked" hidden="" type="radio" name="type" id="type-azhannei" value="<?php echo home_url() ?>/?post_type=sites&amp;s=" data-placeholder="<?php _e('站内搜索','i_theme') ?>"></li>
                <?php wp_menu("search_menu") ?>
            </ul>
        </div>
        <?php $i=0; foreach ($search_list as $value) {
            echo '<div class="search-group '.$value['id'].' '.( $i==0?'':'').'">';
            echo '<ul class="search-type">';
            foreach ($value['list'] as $s) {
                if($i==0 && $s['id']==$value['default'])
                    echo '<li><input checked="checked" hidden type="radio" name="type" id="'.$s['id'].'" value="'.$s['url'].'" data-placeholder="'.$s['placeholder'].'"><label for="'.$s['id'].'"><span class="text-muted">'.$s['name'].'</span></label></li>';
                else
                    echo '<li><input hidden type="radio" name="type" id="'.$s['id'].'" value="'.$s['url'].'" data-placeholder="'.$s['placeholder'].'"><label for="'.$s['id'].'"><span class="text-muted">'.$s['name'].'</span></label></li>';
            }
            echo '</ul>';
            echo '</div>';
            $i++;
        } ?>
    </div>
    <div class="card search-smart-tips" style="display: none">
        <ul></ul>
    </div>
</div>
</div>
<script>var qstr=getUrlParam("q");if(qstr!=null){$("#search-text").val(qstr);}</script>